import { http } from "@/utils/http";

export interface QueryContentDetailById {
  contentId: number;
}

export interface ContentDetailVO {
  id: number;
  userId: number;
  title: string;
  content: string;
  mainImg: string;
  classifyCode: string;
  status: number;
  imgList: string[];
  allowComment: number;
  seeCount: number;
  likeCount: number;
  commentCount: number;
  source: number;
}

export interface RemoveContentById {
  contentId: number;
}

export interface DisableContentById {
  contentId: number;
  enable: boolean;
}

export interface QueryContentInfoByCondition extends BizPageReq {
  id: number;
  userId: number;
  title: number;
  classifyCode: string;
  status: number;
}

export interface ContentBaseVO {
  id: number;
  userId: number;
  title: string;
  mainImg: string;
  classifyCode: string;
  status: number;
  allowComment: number;
  seeCount: number;
  likeCount: number;
  commentCount: number;
  source: number;
}

//查询内容详情信息
export const queryContentDetailByIdApi = (data: QueryContentDetailById) => {
  return http.request<BizResponse<ContentDetailVO>>(
    "post",
    "/content/queryContentDetailById",
    {
      data
    }
  );
};

//删除内容详情信息
export const removeContentByIdApi = (data: RemoveContentById) => {
  return http.request<BizResponse<boolean>>(
    "post",
    "/content/removeContentById",
    {
      data
    }
  );
};

//启禁用内容详情信息
export const disableContentByIdApi = (data: DisableContentById) => {
  return http.request<BizResponse<boolean>>(
    "post",
    "/content/disableContentById",
    {
      data
    }
  );
};

//多条件查询内容详情信息
export const queryContentInfoByConditionApi = (
  data: QueryContentInfoByCondition
) => {
  return http.request<BizResponse<BizPageResult<ContentBaseVO>>>(
    "post",
    "/content/queryContentInfoByCondition",
    {
      data
    }
  );
};
